package com.ruoyi.project.loan.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.loan.domain.ApprovalReport;
import com.ruoyi.project.loan.mapper.ApprovalReportMapper;
import com.ruoyi.project.loan.service.IApprovalReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 审批报告Service业务层处理
 *
 * @author ruoyi
 * @date 2025-11-11
 */
@Service
public class ApprovalReportServiceImpl implements IApprovalReportService {
    @Autowired
    private ApprovalReportMapper approvalReportMapper;

    /**
     * 查询审批报告
     *
     * @param reportId 审批报告主键
     * @return 审批报告
     */
    @Override
    public ApprovalReport selectApprovalReportByReportId(Long reportId) {
        return approvalReportMapper.selectApprovalReportByReportId(reportId);
    }

    /**
     * 查询审批报告列表
     *
     * @param approvalReport 审批报告
     * @return 审批报告
     */
    @Override
    public List<ApprovalReport> selectApprovalReportList(ApprovalReport approvalReport) {
        return approvalReportMapper.selectApprovalReportList(approvalReport);
    }

    /**
     * 新增审批报告
     *
     * @param approvalReport 审批报告
     * @return 结果
     */
    @Override
    public int insertApprovalReport(ApprovalReport approvalReport) {
        approvalReport.setCreateTime(DateUtils.getNowDate());
        return approvalReportMapper.insertApprovalReport(approvalReport);
    }

    /**
     * 修改审批报告
     *
     * @param approvalReport 审批报告
     * @return 结果
     */
    @Override
    public int updateApprovalReport(ApprovalReport approvalReport) {
        approvalReport.setUpdateTime(DateUtils.getNowDate());
        return approvalReportMapper.updateApprovalReport(approvalReport);
    }

    /**
     * 批量删除审批报告
     *
     * @param reportIds 需要删除的审批报告主键
     * @return 结果
     */
    @Override
    public int deleteApprovalReportByReportIds(Long[] reportIds) {
        return approvalReportMapper.deleteApprovalReportByReportIds(reportIds);
    }

    /**
     * 删除审批报告信息
     *
     * @param reportId 审批报告主键
     * @return 结果
     */
    @Override
    public int deleteApprovalReportByReportId(Long reportId) {
        return approvalReportMapper.deleteApprovalReportByReportId(reportId);
    }
}
